using UnityEngine;

public class GameManager : MonoBehaviour
{
    public static GameManager GameManagerInstance { get; set; }

    public GameObject _cruiser;
    public GameObject _camera;
    public GameObject _grid;
    private Material _material;

    public int FramePerSecond;

    private void Awake()
    {
        if (GameManagerInstance != null)
        {
            Destroy(GameManagerInstance);
            return;
        }
        GameManagerInstance = this;
    }

    void Start()
    {
        Application.targetFrameRate = FramePerSecond;
        _material = _grid.GetComponent<Renderer>().material;
    }

    void Update()
    {
        _camera.transform.position = new Vector3(_cruiser.transform.position.x, _cruiser.transform.position.y, _camera.transform.position.z);
        _grid.transform.position = new Vector3(_cruiser.transform.position.x, _cruiser.transform.position.y, _grid.transform.position.z);
        _material.mainTextureOffset = _cruiser.transform.position * 0.05f;//scale: 200 pixle per unit, maybe
    }
}


